﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;

namespace WindowsServiceTscPrint
{
    static class Program
    {

        static string json = "{" +
  " 	OrderNo:\"SG132456789123454878\"," +
  " 	OrderTime:\"2020-09-15 02:55:35\"," +
  " 	ShopNo:\"ASKDFJLS\"," +
  "    ShopName:\"五大花园店\"," +
  "ShopAddress:\"益阳路187号成都博物馆后资源大厦A座14层\"," +
 "ShopTel:\"15896475623\"," +
  " 	ReceivingArea:\"海淀区\"," +
  " 	Address:\"知春路65号中国卫星通信大厦B座23层\"," +
  " 	Revicer:\"陈独秀\"," +
  " 	Phone:\"18828831256\"," +
  " 	Total:\"1758.00\"," +
  " 	ShipFee:\"3.50\"," +
  " 	PointsDiscount:\"-178.00元\"," +
  " 	RealPay:\"600.00\"," +
  " 	Remark:\"帝者怀容,宽行与天下,守意与四方,不废与伦常。帝者怀容,宽行与天下,守意与四方,不废与伦常\"," +
  " 	DataItems:[" +
  " 	\"肥牛#1#59.00#59.00\"," +
  " 	\"大白菜#3#59.00#159.00\"," +
  " 	\"白萝卜#36#59.00#117.00\"," +
  " 	\"千层肚#108#59.00#59.00\"," +
  " 	\"千层肚大虾头#6#59.00#459.00\"," +
  " 	\"千层肚大虾头#4#59.00#59.00\"," +
  " 	\"千层肚大虾头#2#159.00#658.00\"," +
  " 	\"千层肚#911#59.00#59.00\"," +
  " 	\"千层肚#6#59.00#59.00\"," +
  " 	\"黄喉#2#59.00#59.00\"," +
  " 	\"大青涩的平菇#3#110.00#259.00\"" +
  " 	]" +
  "}";
        //品名，数量，单价，小计

        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        static void Main()
        {
            //安装字体
            //InstallFontType.InstallFont();

            ////打印图案
            //TSCLIB_DLL.openport("TSC TTP-244 Pro");
            //TSCLIB_DLL.setup("79", "70", "4", "8", "0", "0", "0");
            //TSCLIB_DLL.clearbuffer();
            //TSCLIB_DLL.sendcommand("DIRECTION 1");
            ////TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");
            ////TSCLIB_DLL.sendcommand("PUTPCX 10,90,\"UL.PCX\"");
            ////TSCLIB_DLL.downloadpcx("logo.pcx", "logo.pcx");
            ////TSCLIB_DLL.sendcommand("PUTPCX 10,10,\"logo.PCX\"");
            ////TSCLIB_DLL.sendcommand("PUTPCX 10,10,\"timg.PCX\"");
            //TSCLIB_DLL.sendcommand("PUTBMP 200,200, \"UL5.BMP\"");
            //TSCLIB_DLL.printlabel("1", "1");
            //TSCLIB_DLL.closeport();

            ////测试打印
            //OrderInfo orderInfo = null;
            //try
            //{
            //    PrintHelpter.PrintMsg(json, out orderInfo);
            //}
            //catch (Exception ex)
            //{
            //    LogHelpter.AddLog(ex.ToString());
            //}

            //启动服务
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new Service1()
            };
            ServiceBase.Run(ServicesToRun);
        }
    }
}
